import sys
import random

from PySide2.QtCore import Qt, Slot
from PySide2.QtWidgets import (QApplication, QLabel, QPushButton, QVBoxLayout,
                               QWidget)
class MyWidget(QWidget):
    def __init__(self):
        QWidget.__init__(self)
        self.hello=["Hallo welt",'您好']
        self.button=QPushButton("点击我")
        self.text=QLabel("hello world")
        self.text.setAlignment(Qt.AlignCenter)

        self.layout=QVBoxLayout()
        self.layout.addWidget(self.text)
        self.layout.addWidget(self.button)
        self.setLayout(self.layout)
        self.button.clicked.connect(self.magic)
    @Slot()
    def magic(self):
        self.text.setText(random.choice(self.hello))

if __name__ == "__main__":
    app = QApplication(sys.argv)

    widget = MyWidget()
    widget.resize(800, 600)
    widget.show()

    sys.exit(app.exec_())
